<xsl:stylesheet version="2.0" 
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
                xmlns:mEXLSR="http://icnet.mitre.org/mEXL/SitRep/" 
                xmlns:sr="urn:oasis:names:tc:emergency:EDXL:SitRep:1.0"
                xmlns:msxsl="urn:schemas-microsoft-com:xslt" 
                xmlns:csharp="http://csharp.org"
                xmlns:cap="urn:oasis:names:tc:emergency:cap:1.2" 
                xmlns:have="urn:oasis:names:tc:emergency:EDXL:HAVE:1.0" 
                xmlns:de="urn:oasis:names:tc:emergency:EDXL:DE:1.0" 
                xmlns:rmsg="urn:oasis:names:tc:emergency:EDXL:RM:1.0:msg" 
                xmlns:rm="urn:oasis:names:tc:emergency:EDXL:RM:1.0"
                xmlns:ct="urn:oasis:names:tc:emergency:edxl:ct:1.0"
                xmlns:n3="http://www.georss.org/georss" 
                xmlns:gml="http://www.opengis.net/gml" 
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                xmlns:xal="urn:oasis:names:tc:ciq:xal:3" 
                xmlns:xnl="urn:oasis:names:tc:emergency:edxl:ciq:1.0:xnl" 
                xmlns:xpil="urn:oasis:names:tc:emergency:edxl:ciq:xpil:3">
	
	<xsl:import href="GML Scripts.xsl"/>
	<xsl:output method="html" indent="yes" exclude-result-prefixes="msxsl csharp"/>

  <xsl:template name="ValueListType" match="*">
    <table  bordercolor="#ababab" border="1px" cellpadding="4" cellspacing="0" width="120">
      <tr>
        <th>
          <b>
            <xsl:value-of select="ct:ValueListURI"/>
          </b>
        </th>
      </tr>

      <xsl:for-each select="ct:Value">
        <tr>
          <td>
            <xsl:value-of select="."/>
          </td>
        </tr>
      </xsl:for-each>

    </table>
  </xsl:template>

  <xsl:template name="ValueKeyPairType" match="*">
    <table  bordercolor="#ababab" border="1px" cellpadding="4" cellspacing="0" width="120">
      <tr>
        <th colspan="2">
          <xsl:value-of select="ct:ValueKeyURI/ct:ValueListURI"/>
        </th>
      </tr>
      <tr>
        <td>
          <xsl:value-of select="ct:ValueKeyURI/ct:Value"/>
        </td>
        <td>
          <xsl:value-of select="ct:PairValue"/>
        </td>
      </tr>
    </table>
  </xsl:template>

  <!-- Each jurisdiction goes in a separate table row-->
  <xsl:template name="JurisdictionType" match="*">
    <tr>
      <td colspan="2">
        <h3>
          Incident Jurisdiction :
          <xsl:value-of select="sr:Name"/>
        </h3>
        <xsl:value-of select="sr:Description"/>

        <br/>
        <br/>
        <b>Geographic Size: </b>
        <xsl:value-of select="sr:GeographicSize"/>
        <br/>
        <br/>
        <xsl:for-each select="sr:Location">
          <xsl:call-template name="DrawArea"/>
        </xsl:for-each>
      </td>
    </tr>
  </xsl:template>
	
	<xsl:template match="*">
		<HTML>
			<HEAD>
				<STYLE TYPE="text/css">
            #main {
              width: 99%;
            }
						.indented
						   {
						   padding-left: 20pt;
						   padding-right: 0pt;
						   padding-top: 0pt;
						   margin-top: 0pt;
						   }
						   
						  .indented2
						   {
						   padding-left: 75pt;
						   padding-right: 50pt;
						   }
						   
						   .indented3
						   {
						   padding-left: 100pt;
						   padding-right: 50pt;
						   }
						   
						   .indented4
						   {
						   padding-left: 125pt;
						   padding-right: 50pt;
						   }
					</STYLE>
				<style type="text/css">
					  #map-canvas {
						height: 500px;
					  }
					</style>

        <script type="text/javascript">
          <xsl:value-of select="document('CommonJavascript.js')" disable-output-escaping="yes" />
        </script>
				<TITLE>SitRep Message</TITLE>
				<!--<link rel="stylesheet" media="screen" type="text/css" href="css/style.css"/>-->
			</HEAD>
			<BODY>
        <div id="main">
          <xsl:for-each select="//sr:SitRep">
            <table bordercolor="#ababab" border="1px" cellpadding="10" cellspacing="0" >
              <tr>
                <td colspan="2">
                  <h2>
                    SitRep ID: <xsl:value-of select="sr:MessageID"/>
                  </h2>
                  <xsl:if test="sr:ReportTitle">
                    <h3>
                      <xsl:value-of select="sr:ReportTitle"/>
                    </h3>
                  </xsl:if>
                  <xsl:if test="sr:OriginatingMessageID">
                    Originated by message ID:<xsl:text> </xsl:text>
                    <xsl:value-of select="sr:OriginatingMessageID"/>
                    <br/>
                  </xsl:if>
                  <xsl:if test="sr:PrecedingMessageID">
                    Preceded by message ID:<xsl:text> </xsl:text>
                    <xsl:value-of select="sr:PrecedingMessageID"/>
                    <br/>
                  </xsl:if>
                </td>
              </tr>
              <!--Common SitRep Message Information -->
              <tr valign="top">
                <td colspan="1">
                  <xsl:for-each select="sr:IncidentID">
                    <b>Incident ID: </b>
                    <xsl:value-of select="."/>
                    <br/>
                  </xsl:for-each>

                  <hr/>

                  <b>Prepared By </b>
                  <xsl:value-of select="sr:PreparedBy/ct:PersonDetails/xnl:PersonName/xnl:NameElement"/>
                  <b> at </b>
                  <script type="text/javascript">
                    document.write(TimeStampToDate("<xsl:value-of select="sr:PreparedBy/ct:TimeValue"/>"));
                  </script>
                  <br/>
                  <b>Authorized By </b>
                  <xsl:value-of select="sr:AuthorizedBy/ct:PersonDetails/xnl:PersonName/xnl:NameElement"/>
                  <b> at </b>
                  <script type="text/javascript">
                    document.write(TimeStampToDate("<xsl:value-of select="sr:PreparedBy/ct:TimeValue"/>"));
                  </script>
                  <br/>
                  <hr/>
                  <b>SitRep for period: </b>
                  <script type="text/javascript">
                    document.write(TimeStampToDate("<xsl:value-of select="sr:ForTimePeriod/ct:FromDateTime"/>"));
                  </script>
                  <b> to </b>
                  <script type="text/javascript">
                    document.write(TimeStampToDate("<xsl:value-of select="sr:ForTimePeriod/ct:ToDateTime"/>"));
                  </script>

                  <hr/>

                  <b>Report Information </b>
                  <p class="indented">
                    <b>Purpose: </b>
                    <xsl:value-of select="sr:ReportPurpose"/>
                    <br/>
                    <b>Number: </b>
                    <xsl:value-of select="sr:ReportNumber"/>
                    <br/>
                    <b>Version: </b>
                    <xsl:value-of select="sr:ReportVersion/sr:Version/ct:ValueListURI"/>
                    <xsl:text> </xsl:text>
                    <xsl:for-each select="sr:ReportVersion/sr:Version/ct:Value">
                      <xsl:value-of select="."/>
                      <xsl:text> </xsl:text>
                    </xsl:for-each>
                    <br/>
                    <b>Confidence: </b>
                    <xsl:value-of select="sr:ReportConfidence/ct:ValueListURI"/>
                    <xsl:text> </xsl:text>
                    <xsl:value-of select="sr:ReportConfidence/ct:Value"/>
                    <br/>
                    <b>Severity: </b>
                    <xsl:value-of select="sr:Severity/sr:SeverityDefault/ct:ValueListURI"/>
                    <xsl:text> </xsl:text>
                    <xsl:value-of select="sr:Severity/sr:SeverityDefault/sr:Value"/>
                    <xsl:if test="sr:Urgency">
                      <br/>
                      <b>Urgency: </b>
                      <xsl:value-of select="sr:Urgency/ct:ValueListURI"/>
                      <xsl:text> </xsl:text>
                      <xsl:value-of select="sr:Urgency/ct:Value"/>
                    </xsl:if>
                  </p>

                  <xsl:if test="sr:ActionPlan">
                    <hr/>
                    <b>Action Plan: </b>
                    <xsl:value-of select="sr:ActionPlan"/>
                  </xsl:if>

                  <xsl:if test="sr:NextContact">
                    <hr/>
                    <b>Next Contact At: </b>
                    <script type="text/javascript">
                      document.write(TimeStampToDate("<xsl:value-of select="sr:NextContact"/>"));
                    </script>
                  </xsl:if>

                  <!-- Prepared by details-->
                  <!-- Authorized by details-->
                </td>
                <xsl:if test="sr:ReportingLocation">
                  <td colspan="1">
                    <h4>Reporting Location</h4>
                    <xsl:for-each select="sr:ReportingLocation">
                      <xsl:call-template name="DrawArea"/>
                    </xsl:for-each>
                  </td>
                </xsl:if>
              </tr>

              <xsl:for-each select="sr:Report">
                <!-- Field Observation-->
                <xsl:if test="./@xsi:type = 'FieldObservation'">
                  <tr>
                    <td colspan="1">
                      <h3>Field Observation</h3>
                      <b>Immediate Needs: </b>
                      <xsl:value-of select="sr:ImmediateNeeds"/>
                      <br/>
                      <xsl:if test="sr:ImmediateNeedsCategory">
                        <b>Immediate Needs Category:</b>
                        <xsl:for-each select="sr:ImmediateNeedsCategory">
                          <xsl:call-template name="ValueListType"/>
                        </xsl:for-each>
                        <br/>
                      </xsl:if>
                      <b>Observation Text: </b>
                      <xsl:value-of select="sr:ObservationText"/>
                    </td>
                    <td colspan="1">
                      <h4>Observation Location</h4>
                      <xsl:for-each select="sr:ObservationLocation">
                        <xsl:call-template name="DrawArea"/>
                      </xsl:for-each>
                    </td>
                  </tr>
                </xsl:if>

                <!-- Situation Information-->
                <xsl:if test="./@xsi:type = 'SituationInformation'">
                  <tr>
                    <th colspan="2">
                      <h3>Situation Information</h3>
                    </th>
                  </tr>
                  <tr>
                    <td>
                      <b>Incident Name: </b>
                      <xsl:value-of select="sr:IncidentName"/>
                      <xsl:if test="sr:IncidentStartDateTime">
                        <br/>
                        <b>Began at </b>
                        <script type="text/javascript">
                          document.write(TimeStampToDate("<xsl:value-of select="sr:IncidentStartDateTime"/>"));
                        </script>
                      </xsl:if>
                      <xsl:if test="sr:IncidentType">
                        <br/>
                        <br/>
                        <b>Incident Type</b>
                        <xsl:for-each select="sr:IncidentType">
                          <xsl:call-template name="ValueListType"/>
                        </xsl:for-each>
                      </xsl:if>
                      <xsl:if test="sr:IncidentComplexity">
                        <br/>
                        <b>Incident Complexity</b>
                        <xsl:for-each select="sr:IncidentComplexity">
                          <xsl:call-template name="ValueListType"/>
                        </xsl:for-each>
                      </xsl:if>

                      <xsl:if test="sr:IncidentGeographicSize">
                        <br/>
                        <br/>
                        <b>Geographic Size: </b>
                        <xsl:value-of select="sr:IncidentGeographicSize"/>
                      </xsl:if>

                      <xsl:for-each select="sr:DisasterInformation">
                        <br/>
                        <br/>
                        <b>Disaster Information:</b>
                        <p class="indented">
                          <b>Disaster Name: </b>
                          <xsl:value-of select="sr:DisasterName"/>
                          <br/>
                          <b>Disaster Declared At: </b>
                          <script type="text/javascript">
                            document.write(TimeStampToDate("<xsl:value-of select="sr:DisasterDeclarationDateTime"/>"));
                          </script>
                          <br/>
                          <b>Disaster Declaration Authority: </b>
                          <xsl:value-of select="sr:DisasterDeclarationAuthority"/>
                        </p>
                      </xsl:for-each>
                    </td>
                    <td>
                      <h4>Incident Location</h4>
                      <xsl:for-each select="sr:IncidentLocation">
                        <xsl:call-template name="DrawArea"/>
                      </xsl:for-each>
                    </td>
                  </tr>
                  <!--Each jurisdiction goes in a separate row-->
                  <xsl:for-each select="sr:JurisdictionInformation">
                    <xsl:call-template name="JurisdictionType"/>
                  </xsl:for-each>
                  for-each
                  <tr>
                    <td colspan="2">
                      <h4>
                        Incident Staging: <xsl:text> </xsl:text>
                        <xsl:value-of select="sr:IncidentStaging/sr:IncidentStagingArea"/>
                      </h4>

                      <xsl:for-each select="sr:IncidentStaging/sr:IncidentStagingAreaLocation">
                        <xsl:call-template name="DrawArea"/>
                      </xsl:for-each>
                    </td>
                  </tr>
                </xsl:if>

                <!-- Casualty and Illness Summary-->
                <xsl:if test="./@xsi:type = 'CasualtyAndIllnessSummary'">
                  <tr>
                    <td colspan="2">
                      <h3>Casualty and Illness Summary</h3>
                      <hr/>
                      <xsl:for-each select="sr:SummaryCount">
                        <h4>Summary Count:</h4>
                        <b>Count Category: </b>
                        <xsl:value-of select="sr:CasualtyAndIllnessCountCategory/sr:CountCategory/ct:ValueListURI"/>
                        <xsl:text> </xsl:text>
                        <xsl:value-of select="sr:CasualtyAndIllnessCountCategory/sr:CountCategory/ct:Value"/>
                        <br/>
                        <br/>
                        <table  bordercolor="#ababab" border="1px" cellpadding="4" cellspacing="0" width="500">
                          <tr>
                            <th>Responder Summary Count</th>
                            <th>Responder Summary Count to Date</th>
                          </tr>
                          <tr>
                            <td>
                              <xsl:value-of select="sr:ResponderSummaryCount"/>
                            </td>
                            <td>
                              <xsl:value-of select="sr:ResponderSummaryCountToDate"/>
                            </td>
                          </tr>
                          <tr>
                            <th>Non-Responder Summary Count</th>
                            <th>Non-Responder Summary Count to Date</th>
                          </tr>
                          <tr>
                            <td>
                              <xsl:value-of select="sr:NonResponderSummaryCount"/>
                            </td>
                            <td>
                              <xsl:value-of select="sr:NonResponderSummaryCountToDate"/>
                            </td>
                          </tr>
                          <tr>
                            <th>Require Mass Immunization</th>
                            <th>Have Received Mass Immunization</th>
                          </tr>
                          <tr>
                            <td>
                              <xsl:value-of select="sr:RequireMassImmunizationsCount"/>
                            </td>
                            <td>
                              <xsl:value-of select="sr:HaveReceivedMassImmunizationsCount"/>
                            </td>
                          </tr>
                          <tr>
                            <th>Shelter Count Estimate</th>
                          </tr>
                          <tr>
                            <td>
                              <xsl:value-of select="sr:ShelterCountEstimate"/>
                            </td>
                          </tr>
                        </table>
                        <hr/>
                      </xsl:for-each>

                      <xsl:for-each select="sr:NotifiableDiseaseNumbers">
                        <h4>Notifiable Disease Numbers:</h4>
                        <b>Disease Suspected: </b>
                        <xsl:value-of select="sr:DiseaseSuspected/ct:ValueListURI"/>
                        <xsl:text> </xsl:text>
                        <xsl:value-of select="sr:DiseaseSuspected/ct:Value"/>
                        <br/>
                        <b>Probable Cause: </b>
                        <xsl:value-of select="sr:ProbableCause"/>
                        <br/>
                        <table  bordercolor="#ababab" border="1px" cellpadding="4" cellspacing="0" width="500">
                          <tr>
                            <th>Suspected Cases</th>
                            <th>Confirmed Cases</th>
                          </tr>
                          <tr>
                            <td>
                              <xsl:value-of select="sr:CountOfSuspectedCases"/>
                            </td>
                            <td>
                              <xsl:value-of select="sr:CountOfConfirmedCases"/>
                            </td>
                          </tr>
                        </table>
                        <hr/>
                      </xsl:for-each>
                    </td>
                  </tr>
                </xsl:if>

                <!-- Managment Reporting Summary-->
                <xsl:if test="./@xsi:type='ManagementReportingSummary'">
                  <xsl:for-each select="sr:SituationSummary">
                    <tr>
                      <td colspan="2">
                        <h3>Situation Summary</h3>
                      </td>
                    </tr>
                    <tr valign="top">
                      <td>
                        <b>Incident Cause: </b>
                        <xsl:value-of select="sr:IncidentCause"/>
                        <br/>
                        <xsl:for-each select="sr:SignificantEvents">
                          <br/>
                          <b>Significant Events: </b>
                          <xsl:call-template name="ValueListType"/>
                          <br/>
                        </xsl:for-each>
                        <xsl:for-each select="sr:IncidentThreatSummaryAndRisk">
                          <br/>
                          <b>Incident Threat Summary: </b>
                          <xsl:value-of select="."/>
                          <br/>
                        </xsl:for-each>
                        <br/>
                        <b>Human Life and Saftey Threat: </b>
                        <xsl:value-of select="sr:HumanLifeAndSafetyThreat"/>
                        <br/>
                        <xsl:for-each select="sr:LifeAndSafetyThreat">
                          <br />
                          <b>Life and Saftey Threats: </b>
                          <xsl:call-template name="ValueListType"/>
                          <br/>
                        </xsl:for-each>
                        <xsl:for-each select="sr:PrimaryHazards">
                          <br/>
                          <b>Primary Hazards: </b>
                          <xsl:value-of select="."/>
                          <br/>
                        </xsl:for-each>
                        <xsl:for-each select="sr:WeatherEffects">
                          <br/>
                          <b>Weather Concnerns: </b>
                          <xsl:value-of select="ct:WeatherConcerns"/>
                          <br/>
                        </xsl:for-each>
                        <xsl:for-each select="sr:GeneralPopulationStatus">
                          <br/>
                          <b>General Population Status: </b>
                          <xsl:value-of select="."/>
                          <br/>
                        </xsl:for-each>
                        <xsl:for-each select="sr:FollowOnIndication">
                          <br/>
                          <b>Follow On?: </b>
                          <xsl:value-of select="."/>
                          <br/>
                        </xsl:for-each>
                        <xsl:for-each select="sr:RequestsForAdditionalSupport">
                          <br/>
                          <b>Requests for Additional Support?: </b>
                          <xsl:value-of select="."/>
                          <br/>
                        </xsl:for-each>
                        <xsl:for-each select="sr:PercentContained">
                          <br/>
                          <b>Percent Contained: </b>
                          <xsl:value-of select="."/>%
                          <br/>
                        </xsl:for-each>
                        <xsl:if test="sr:TransportationSystems">
                          <br/>
                          <b>Transportation Systems: </b>
                          <br/>
                        </xsl:if>
                        <xsl:for-each select="sr:TransportationSystems">
                          <xsl:call-template name="ValueKeyPairType"/>
                          <br/>
                        </xsl:for-each>
                      </td>
                      <td>
                        <xsl:for-each select="sr:DamageAssessmentInformation">
                          <b>Damage Assessment Source: </b>
                          <xsl:value-of select="."/>
                          <br/>
                        </xsl:for-each>
                        <xsl:for-each select="sr:InfrastructureAffected">
                          <br/>
                          <b>Infrastructure Affected: </b>
                          <xsl:call-template name="ValueListType"/>
                          <br/>
                        </xsl:for-each>

                        <xsl:if test="sr:PropertyDamage">
                          <br/>
                          <b>Property Damange: </b>
                          <br/>
                        </xsl:if>
                        <xsl:for-each select="sr:PropertyDamage">
                          <xsl:call-template name="ValueKeyPairType"/>
                          <br/>
                        </xsl:for-each>

                        <hr/>
                        <h4>HAZMAT Incident Report</h4>
                        <br/>
                        <xsl:for-each select="sr:ExtentOfContamination">
                          <b>Extent of Contamination: </b>
                          <br/>
                          <xsl:call-template name="DrawArea"/>
                          <br/>
                        </xsl:for-each>

                        <hr/>
                        <xsl:for-each select="sr:TerrorismNexus">
                          <br/>
                          <b>Terrorism Nexus: </b>
                          <xsl:value-of select="."/>
                          <br/>
                        </xsl:for-each>
                        <xsl:for-each select="sr:WMDEffects">
                          <br/>
                          <b>WMD Effects: </b>
                          <xsl:value-of select="."/>
                          <br/>
                        </xsl:for-each>
                      </td>
                    </tr>

                  </xsl:for-each>

                  <xsl:for-each select="sr:DecisionSupportInformation">
                    <tr>
                      <td colspan="2">
                        <h3>Decision Support Information</h3>
                      </td>
                    </tr>
                    <tr valign="top">
                      <td>
                        <xsl:for-each select="sr:ProjectedIncidentActivity">
                          <b>Projected Incident Activity: </b>
                          <xsl:call-template name="ValueKeyPairType"/>
                          <br/>
                        </xsl:for-each>
                        <xsl:for-each select="sr:ProjectedNumberToBeSheltered">
                          <br/>
                          <b>Projected Requring Shelter: </b>
                          <xsl:value-of select="."/>
                          <br/>
                        </xsl:for-each>
                        <xsl:for-each select="sr:EmergencyResponseIssues">
                          <b>Emergency Response Issues: </b>
                          <xsl:call-template name="ValueKeyPairType"/>
                          <br/>
                        </xsl:for-each>
                        <xsl:if test="sr:CriticalResourceNeeds">
                          <br/>
                          <b>Critical Resource Needs: </b>
                          <br/>
                        </xsl:if>
                        <xsl:for-each select="sr:CriticalResourceNeeds">
                          <xsl:call-template name="ValueKeyPairType"/>
                          <br/>
                        </xsl:for-each>
                        <xsl:for-each select="sr:PlannedActions">
                          <br/>
                          <b>Planned Actions: </b>
                          <xsl:value-of select="."/>
                          <br/>
                        </xsl:for-each>
                      </td>
                      <td>
                        <xsl:for-each select="sr:ProjectedFinalIncidentSize">
                          <b>Projected Final Incident Size: </b>
                          <xsl:value-of select="."/>
                          <br/>
                        </xsl:for-each>
                        <xsl:for-each select="sr:AnticipatedCompletionDate">
                          <br/>
                          <b>Anticipated Completion Date: </b>
                          <script type="text/javascript">
                            document.write(TimeStampToDate("<xsl:value-of select="."/>"));
                          </script>
                          <br/>
                        </xsl:for-each>
                        <xsl:for-each select="sr:ProjectedDemobilizationStartDate">
                          <b>Projected Demobilization Start Date: </b>
                          <script type="text/javascript">
                            document.write(TimeStampToDate("<xsl:value-of select="."/>"));
                          </script>
                          <br/>
                        </xsl:for-each>
                        <xsl:for-each select="sr:EstimatedCostsToDate">
                          <br/>
                          <b>Estimated Costs to Date: </b>
                          <xsl:value-of select="."/>
                          <br/>
                        </xsl:for-each>
                        <xsl:for-each select="sr:ProjectedFinalCosts">
                          <br/>
                          <b>Estimated Costs to Date: </b>
                          <xsl:value-of select="."/>
                          <br/>
                        </xsl:for-each>
                        <xsl:for-each select="sr:StrategicDiscussion">
                          <br/>
                          <br/>
                          <b>Strategic Discussion: </b>
                          <xsl:value-of select="."/>
                          <br/>
                        </xsl:for-each>
                      </td>
                    </tr>
                  </xsl:for-each>

                  <!--Each jurisdiction goes in a separate row-->
                  <xsl:for-each select="sr:JurisdictionInformation">
                    <xsl:call-template name="JurisdictionType"/>
                  </xsl:for-each>
                </xsl:if>

                <!-- Response Resource Totals-->
                <xsl:if test="./@xsi:type='ResponseResourcesTotals'">
                  <xsl:for-each select="sr:ResourceTotal">
                  <tr>
                    <td colspan="2">
                      <h3>Resource Total</h3>
                      <h4>Branch Division Group: <xsl:value-of select="sr:BranchDivisionGroup"/>
                      </h4>

                      <xsl:for-each select="sr:Resource">
                        <hr />
                        <h4>Resource: <xsl:value-of select="sr:ResourceName"/>
                        </h4>
                        <b>Agency or Organization: </b>
                        <xsl:value-of select="sr:AgencyOrganization"/>
                        <br/>
                        
                        <xsl:if test="sr:ResourceDetail/sr:AdditionalAssistingOrganizations">
                          <br/>
                          <b>Assisted By: </b>
                          <xsl:value-of select="sr:ResourceDetail/sr:AdditionalAssistingOrganizations"/>
                        </xsl:if>
                        <br/>
                        <xsl:for-each select="sr:ResourceDetail/sr:ResourcePersonnelCount">
                          <br/>
                          <b>Resource Personnel: </b>
                          <xsl:value-of select="."/>
                        </xsl:for-each>
                        <xsl:for-each select="sr:ResourceDetail/sr:UnassignedResourcePersonnel">
                          <br/>
                          <b>Unassigned Resource Personnel: </b>
                          <xsl:value-of select="."/>
                          <br/>
                        </xsl:for-each>
                        
                        <xsl:for-each select="sr:ResourceTypeCategoryKind">
                          <br/>
                          <b>Resource Type: </b>
                          <xsl:call-template name="ValueListType"/>
                        </xsl:for-each>

                        <xsl:for-each select="sr:ResourceDetail">
                          <h4>Counts:</h4>
                          <table  bordercolor="#ababab" border="1px" cellpadding="4" cellspacing="0">
                            <tr>
                              <th>Needed</th>
                              <th>Requested</th>
                              <th>Required</th>
                              <th>Committed</th>
                              <th>On Hand</th>
                            </tr>
                            <tr>
                              <td>
                                <xsl:value-of select="sr:ResourceNeededCount"/>
                              </td>
                              <td>
                                <xsl:value-of select="sr:ResourceRequestedCount"/>
                              </td>
                              <td>
                                <xsl:value-of select="sr:ResourceRequiredCount"/>
                              </td>
                              <td>
                                <xsl:value-of select="sr:ResourceCommittedCount"/>
                              </td>
                              <td>
                                <xsl:value-of select="sr:ResourceOnHandCount"/>
                              </td>
                            </tr>
                          </table>
                          <br/>
                          <br/>
                          <xsl:for-each select="sr:DateTimeOrdered">
                            <b>Ordered On: </b>
                            <script type="text/javascript">
                              document.write(TimeStampToDate("<xsl:value-of select="."/>"));
                            </script>
                            <br/>
                          </xsl:for-each>
                          <xsl:for-each select="sr:RequestedArrival">
                            <b>Requested Arrival: </b>
                            <script type="text/javascript">
                              document.write(TimeStampToDate("<xsl:value-of select="."/>"));
                            </script>
                            <br/>
                          </xsl:for-each>
                          <xsl:for-each select="sr:EstimatedArrival">
                            <b>Estimated Arrival: </b>
                            <script type="text/javascript">
                              document.write(TimeStampToDate("<xsl:value-of select="."/>"));
                            </script> 
                            <br/>
                          </xsl:for-each>
                          <xsl:if test="sr:OverheadPosition">
                            <br />
                            <b>Overhead Position:</b>
                            <xsl:for-each select="sr:OverheadPosition">
                              <br/>
                              <xsl:call-template name="ValueKeyPairType"/>
                            </xsl:for-each>
                            <br/>
                          </xsl:if>

                          <xsl:for-each select="sr:WorkAssignment">
                            <br/>
                            <b>Work Assignment: </b>
                            <xsl:value-of select="."/>
                            <br/>
                          </xsl:for-each>
                          <xsl:for-each select="sr:SpecialInstructions">
                            <br/>
                            <b>Special Instructions: </b>
                            <xsl:value-of select="."/>
                            <br/>
                          </xsl:for-each>
                          <xsl:if test="sr:SpecialEquipmentAndSupplies">
                            <br />
                            <b>Special Equipment/Supplies:</b>
                            <xsl:for-each select="sr:SpecialEquipmentAndSupplies">
                              <br/>
                              <xsl:value-of select="."/>
                            </xsl:for-each>
                            <br/>
                          </xsl:if>
                          <h4>Report To:</h4>
                          <xsl:for-each select="sr:ReportToLocation">
                            <xsl:call-template name="DrawArea"/>
                          </xsl:for-each>
                        </xsl:for-each>
                      </xsl:for-each>
                    </td>
                  </tr>
                 
                </xsl:for-each>

                  <xsl:for-each select="sr:OrganizationAndAssignments">
                    <tr>
                      <td colspan="2">
                        <h3>Organization and Assignment</h3>
                        <xsl:for-each select="sr:CommandStructure">
                          <b>Command Structure: </b>
                          <xsl:value-of select="."/>
                          <br/>
                        </xsl:for-each>
                        <xsl:for-each select="sr:PositionTitle">
                          <br/>
                          <b>Position Title: </b>
                          <xsl:call-template name="ValueKeyPairType"/>
                          <br/>
                        </xsl:for-each>
                        <xsl:for-each select="sr:PersonName">
                          <br/>
                          <b>Name: </b>
                          <xsl:value-of select="xnl:PersonName/xnl:NameElement"/>
                          <br/>
                        </xsl:for-each>
                        <xsl:for-each select="sr:Branch">
                          <b>Branch: </b>
                          <xsl:value-of select="ct:ValueListURI"/>
                          <xsl:text> </xsl:text>
                          <xsl:value-of select="ct:Value"/>
                          <br/>
                        </xsl:for-each>
                        <xsl:for-each select="sr:ReportsToPersonName">
                          <br/>
                          <b>Reports To: </b>
                          <xsl:value-of select="xnl:PersonName/xnl:NameElement"/>
                          <br/>
                        </xsl:for-each>
                        <xsl:for-each select="sr:ReportsToPositionTitle">
                          <b>Reports To Position: </b>
                          <xsl:value-of select="ct:ValueListURI"/>
                          <xsl:text> </xsl:text>
                          <xsl:value-of select="ct:Value"/>
                          <br/>
                        </xsl:for-each>
                        <xsl:if test="sr:ReportsToAgency">
                          <b>Reports To Agency: </b>
                          <br/>
                          <xsl:for-each select="sr:ReportsToAgency">
                            <xsl:call-template name="ValueListType"/>
                            <br/>
                          </xsl:for-each>
                          <br/>
                        </xsl:if>
                        <xsl:for-each select="sr:ReportsToBranch">
                          <b>Reports To Branch: </b>
                          <xsl:value-of select="ct:ValueListURI"/>
                          <xsl:text> </xsl:text>
                          <xsl:value-of select="ct:Value"/>
                          <br/>
                        </xsl:for-each>
                      </td>
                    </tr>
                  </xsl:for-each>
              </xsl:if>
            </xsl:for-each>
            </table>
          </xsl:for-each>
        </div>
</BODY>
		</HTML>
	</xsl:template>
  
</xsl:stylesheet>
